Skip to content

Exploring possible bug in get_complete_scenarios_for_magicc - #70

Merged
mzecc merged 3 commits into
openscm:mainfrom
mzecc:maybe_bug
Jul 30, 2026
Merged

Exploring possible bug in get_complete_scenarios_for_magicc#70
mzecc merged 3 commits into
openscm:mainfrom
mzecc:maybe_bug

Conversation

@mzecc

@mzecc mzecc commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Exploring possible bug in cmip7_scenariomip/scm_running/get_complete_scenarios_for_magicc.

I discovered an unexpected behavior (to me) playing around with artificial constant emission and I though we might have some bug.

Checklist`

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

@mzecc
mzecc requested a review from znicholls July 27, 2026 15:40
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.64%. Comparing base (870aa9a) to head (5b561af).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   72.56%   72.64%   +0.08%     
==========================================
  Files          44       44              
  Lines        1972     1978       +6     
  Branches      189      190       +1     
==========================================
+ Hits         1431     1437       +6     
  Misses        499      499              
  Partials       42       42              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@znichollscr

Copy link
Copy Markdown
Collaborator

I see and understand the bug. Thanks for spotting and fixing. I assume this didn't affect anything in SCI, because we haven't noticed until now?

@mzecc

mzecc commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

I see and understand the bug. Thanks for spotting and fixing. I assume this didn't affect anything in SCI, because we haven't noticed until now?

I think it was unlikely to occur in any real scenario. I only ran into it because I was playing around with some synthetic scenarios and toggled the checks off. I wanted to see the ocean's response to cumulative CO2, so I basically set everything to 0 except a constant CO2|Fossil.

@znichollscr

Copy link
Copy Markdown
Collaborator

Ok cool. Let's add a test specifically for these cases (but just run 1 MAGICC cfg or even skip running in MAGICC), then do the fix, then we can merge

@mzecc

mzecc commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

Should we accept to work with a duplicated scenario input (and drop duplicates) ? Or do we raise an error?

@znichollscr

Copy link
Copy Markdown
Collaborator

If there are two trajectories which are identical for model, scenario and variable, raise an error

@mzecc

mzecc commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

This should fix it.

@znichollscr znichollscr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Bit of tidy up then good to merge

.duplicated(subset=["model", "scenario", "variable"])
.any()
):
msg = "'scenarios' has duplicate index: model, scenario, variable"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the duplicate model - scenario - variable to the error message please

@@ -0,0 +1,88 @@
"""
Tests of `gcages.cmip7_scenariomip.scm_running.get_complete_scenarios_for_magicc

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Tests of `gcages.cmip7_scenariomip.scm_running.get_complete_scenarios_for_magicc
Tests of `gcages.cmip7_scenariomip.scm_running.get_complete_scenarios_for_magicc`

Comment thread tests/unit/completeness/test_get_complete_scenarios_for_magicc.py
@mzecc
mzecc requested a review from znichollscr July 29, 2026 07:39

@znichollscr znichollscr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks

@mzecc
mzecc merged commit be23ebd into openscm:main Jul 30, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants